package com.kfyty.loveqq.framework.core.converter;

import com.kfyty.loveqq.framework.core.utils.CommonUtil;
import com.kfyty.loveqq.framework.core.utils.ConverterUtil;

/**
 * 描述:
 *
 * @author kfyty725
 * @date 2022/3/12 12:49
 * @email kfyty725@hotmail.com
 */
public class StringToCharacterConverter implements Converter<String, Character> {

    public StringToCharacterConverter() {
        ConverterUtil.registryConverter(String.class, char.class, this);
    }

    @Override
    public Character apply(String source) {
        if (CommonUtil.empty(source)) {
            return null;
        }
        return source.charAt(0);
    }
}
